def register_user():
    id = input("请输入ID: ")
    email = input("请输入EMAIL地址: ")
    id_card = input("请输入身份证号: ")
    name = input("请输入姓名: ")

    if len(id) > 8:
        print("ID长度不能超过8位。")
    elif not all(char.isalnum() or char == '_' for char in id):
        print("ID只能由数字、字母、下划线组成。")
    elif '@' not in email or '.' not in email.split('@')[1]:
        print("EMAIL地址格式不正确。")
    elif len(id_card) != 18 or not id_card[:-1].isdigit() or (id_card[-1].isdigit() and id_card[-1].upper() != 'X'):
        print("身份证号格式不正确。")
    elif len(name) > 4 or not all('\u4e00' <= char <= '\u9fff' for char in name):
        print("姓名只能中文且不能超过4位。")
    else:
        print("注册成功！")

# 程序入口，调用注册函数
register_user()
